import React, { Component } from 'react'
import { connect } from 'react-redux'
import {add,minus,asyncAdd} from '../store/count.redux'

const mapStateToProps = state => ({num:state.counter});
const mapDispatchToprops = {
  add,minus,asyncAdd
} 

@connect(mapStateToProps,mapDispatchToprops)
class ReduxTest extends Component {
  render() {
    const {num,add,minus,asyncAdd} = this.props;
    return (
      <div>
        <p>{num}</p>
        <div>
          <button onClick={asyncAdd}>异步+</button>
          <button onClick={add}>+</button>
          <button onClick={minus}>-</button>
        </div>
      </div>
    )
  }
}
export default ReduxTest
